Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/takserver/src/commonMain/kotlin/org/meshtastic/core/takserver/TAKServer.kt fix/qr-error-correction (7b45f84f) Text, 3.17 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.takserver

Tff7b72import T7ee787kotlinx.coroutines.CoroutineScope
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.core.di.CoroutineDispatchers

T8b949e/**
* Platform-agnostic contract for the Meshtastic TAK server.
*
* The production implementation on Android / JVM runs a TLS (mTLS) listener on port [DEFAULT_TAK_PORT] (8089) using the
* bundled server identity. This matches the Meshtastic-Apple (iOS) implementation so that a single exported `.zip` data
* package is valid for ATAK on Android AND iTAK on iOS without re-configuration.
*
* The interface deliberately hides the platform socket / TLS primitives so that `commonMain` code
* (`TAKServerManagerImpl`, DI, tests) can depend on it without pulling `javax.net.ssl.*` into the common source set.
*/
Tff7b72interface T56d364TAKServer Tb4b4b4{

T8b949e/** Whether this platform provides a local TAK listener. */
Tff7b72val Te6edf3isSupportedTb4b4b4: Tffa657Boolean
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Tff7b72true

T8b949e/** Observable count of currently-connected TAK clients (ATAK/iTAK). */
Tff7b72val Te6edf3connectionCountTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657IntTff7b72>

T8b949e/** Callback invoked on the IO dispatcher for every inbound CoT message from a client. */
Tff7b72var Te6edf3onMessageTb4b4b4: Tb4b4b4(Tb4b4b4(Te6edf3CoTMessageTb4b4b4, Te6edf3TAKClientInfo?Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tff7b72?

T8b949e/** Callback invoked when a TAK client connects. Use to drain queued messages. */
Tff7b72var Te6edf3onClientConnectedTb4b4b4: Tb4b4b4(Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tff7b72?

T8b949e/** Bind the listener and begin accepting connections. Idempotent if already running. */
Tff7b72suspend Tff7b72fun Td2a8ffstartTb4b4b4(Te6edf3scopeTb4b4b4: Te6edf3CoroutineScopeTb4b4b4)Tb4b4b4: Te6edf3ResultTff7b72<Tffa657UnitTff7b72>

T8b949e/** Stop the listener, close all client sockets, and release OS resources. */
Tff7b72fun Td2a8ffstopTb4b4b4(Tb4b4b4)

T8b949e/** Broadcast a CoT message to every currently-connected client. */
Tff7b72suspend Tff7b72fun Td2a8ffbroadcastTb4b4b4(Te6edf3cotMessageTb4b4b4: Te6edf3CoTMessageTb4b4b4)

T8b949e/**
* Broadcast raw CoT XML to every currently-connected client. Used for mesh-originated messages that should be
* forwarded verbatim without re-parsing through the app's CoTXmlParser (which strips shape detail elements like
* strokeColor, fillColor, vertices, etc.).
*/
Tff7b72suspend Tff7b72fun Td2a8ffbroadcastRawXmlTb4b4b4(Te6edf3xmlTb4b4b4: Tffa657StringTb4b4b4)

T8b949e/** Returns true if at least one TAK client is currently connected. */
Tff7b72suspend Tff7b72fun Td2a8ffhasConnectionsTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Boolean
Tb4b4b4}

T8b949e/**
* Platform factory for [TAKServer]. The JVM/Android implementation lives in `jvmAndroidMain` and uses JSSE
* (`SSLServerSocket`) with the bundled `server.p12` identity and `ca.pem` client trust store.
*/
Tff7b72expect Tff7b72fun Td2a8ffcreateTAKServerTb4b4b4(Te6edf3dispatchersTb4b4b4: Te6edf3CoroutineDispatchersTb4b4b4, Te6edf3portTb4b4b4: Tffa657Int Tff7b72= Te6edf3DEFAULT_TAK_PORTTb4b4b4)Tb4b4b4: Te6edf3TAKServer

Served by rngit 1.5.0 - Generated in 0.04s